import jpg2pdf
import os

with jpg2pdf.create('test.pdf') as pdf:
    folder = './demo'
    filelist = os.listdir(folder)
    for i in filelist:
        pdf.add(folder+'/'+i);



